ARG DOCKER_REGISTRY
FROM ${DOCKER_REGISTRY}/base/nginx-php-fpm:latest

RUN groupmod -g 1000 www-data

RUN apt-get update && apt-get install -y --no-install-recommends cron supervisor \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

# Set up cron
#COPY cron/laravel /tmp/laravel
#RUN chmod 0644 /tmp/laravel \
#    && touch /var/log/cron.log \
#    && crontab /tmp/laravel -u www-data

RUN touch /var/log/cron.log && \
    chown -R www-data:www-data /var/log/cron.log

# Configure supervisord
COPY supervisord.conf /etc/supervisor/
COPY supervisor /etc/supervisor/conf.d/

COPY docker-entrypoint.sh /root/docker-entrypoint.sh

RUN chmod +x /root/docker-entrypoint.sh && \
    touch /var/log/supervisor/cron.log

ENTRYPOINT ["/root/docker-entrypoint.sh"]

EXPOSE 9000
